package com.chushouya.manager.config;

import com.chushouya.common.constant.ConfigTypeEnum;

import java.util.Objects;

/**
 * 业务参数
 * checking system configs is existed when project starting，if not exist init db and load to cache
 */
public enum BizConfigEnum {

    COMPLETE_PRICE_RANGE("complete_price_range", ConfigTypeEnum.integer, "成交价价格区间", "500", "成交价价格区间"),
    ORDER_MAX_PAY_DAYS("order_max_pay_days", ConfigTypeEnum.integer, "订单最大可支付天数", "30", "订单最大可支付天数"),
    KEFU_PAY_ORDER_TIME("kefu_pay_order_time", ConfigTypeEnum.jsonObject, "客服可支付订单时间段", "[\"09:00\",\"21:00\"]", "客服可支付订单时间段"),
    GLOBAL_PAY_SWITCH("global_pay_switch", ConfigTypeEnum.integer, "全局支付开关", "0", "全局支付开关"),
    CLERK_CLOSE_ORDER_AFTER_NOT_COMPLETE("clerk_close_order_after_not_complete", ConfigTypeEnum.integer, "业务员质检后30分钟关闭订单", "0", "业务员质检后30分钟关闭订单"),
    ALIPAY_USER_PAY_MAX_PRICE("alipay_user_pay_max_price", ConfigTypeEnum.integer, "单个支付宝账户最大限额", "1000000", "单个支付宝账户最大限额"),
    ALIPAY_USER_PAY_MAX_TIMES("alipay_user_pay_max_times", ConfigTypeEnum.integer, "单个支付宝最大可支付次数", "3", "单个支付宝最大可支付次数"),
    MAX_PAY_PRICE("max_pay_price", ConfigTypeEnum.integer, "单笔订单最大限制额度", "10000", "单笔订单最大限制额度"),
    REPORT_ORDER_EXPRESS_PARTNER_LIST("report_order_express_partner_list", ConfigTypeEnum.jsonArray, "渠道快递合作商列表", "[]", "渠道快递合作商列表"),
    AUTO_CHANGE_DOOR_ORDER_STATUS("auto_change_door_order_status", ConfigTypeEnum.integer, "自动修改上门订单状态", "0", "自动修改上门订单状态"),
    FORBID_RESET_ORDER_PARTNER_LIST("forbid_reset_order_partner_list", ConfigTypeEnum.jsonArray, "禁止重置的订单渠道", "[\"1\"]", "禁止重置的订单渠道"),
    FORBID_MAIL_TO_DOOR_PARTNER_LIST("forbid_mail_to_door_partner_list", ConfigTypeEnum.jsonArray, "禁止邮寄转上门的订单渠道", "[\"1\"]", "禁止邮寄转上门的订单渠道"),
    ALIPAY_EXPRESS_ORDER_STATUS_CIRCUIT("alipay_express_order_status_circuit", ConfigTypeEnum.jsonObject, "支付宝快递状态流转流程", "[]", "支付宝快递状态流转流程"),
    ALIPAY_DOOR_ORDER_STATUS_CIRCUIT("alipay_door_order_status_circuit", ConfigTypeEnum.jsonObject, "支付宝上门状态流转流程", "[]", "支付宝上门状态流转流程"),
    SMS_CLERK_SCENE("sms_clerk_scene", ConfigTypeEnum.jsonObject, "业务员各订单节点短信通知", "{}", "业务员各订单节点短信通知"),
    SMS_SCENE("sms_scene", ConfigTypeEnum.jsonObject, "短信场景", "{}", "短信场景"),
    PARTNER_DEPT_ID("partner_dept_id", ConfigTypeEnum.text, "合作商部门ID", "", "合作商部门ID"),
    PARTNER_ROLE_ID("partner_role_id", ConfigTypeEnum.text, "合作商角色ID", "", "合作商角色ID"),
    NOT_ORDER_SYNC_CITY("not_order_sync_city", ConfigTypeEnum.jsonArray, "不需要同步订单的城市列表", "[]", "不需要同步订单的城市列表"),
    MIN_SYNC_SUHUISHOU_ORDER_PRICE("min_sync_suhuishou_order_price", ConfigTypeEnum.integer, "最低可以同步给速回收的订单金额", "600", "最低可以同步给速回收的订单金额"),
    IGNORE_PAYMENT_PARTNER("ignore_payment_partner", ConfigTypeEnum.jsonArray, "忽略支付的渠道", "[]", "忽略支付的渠道"),
    //忽略的手机号
    IGNORE_SUHUISHOU_MOBILE("ignore_suhuishou_mobile", ConfigTypeEnum.jsonArray, "忽略同步速回收的手机号", "[]", "忽略支付的手机号"),
    ;

    private String configKey;

    private String configName;

    private ConfigTypeEnum configType;

    private String configValue;

    private String remark;

    BizConfigEnum(String configKey, ConfigTypeEnum configType, String configName, String configValue, String remark) {
        this.configKey = configKey;
        this.configType = configType;
        this.configName = configName;
        this.configValue = configValue;
        this.remark = remark;
    }

    public String getConfigKey() {
        return configKey;
    }

    public void setConfigKey(String configKey) {
        this.configKey = configKey;
    }

    public String getConfigName() {
        return configName;
    }


    public String getConfigValue() {
        return configValue;
    }

    public String getRemark() {
        return remark;
    }

    public ConfigTypeEnum getConfigType() {
        return configType;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public static BizConfigEnum getByConfigKey(String configKey) {
        for (BizConfigEnum thisEnum : BizConfigEnum.values()) {
            if (Objects.equals(thisEnum.configKey, configKey)) {
                return thisEnum;
            }
        }
        return null;
    }
}
